Skip to content

Replace test-bridge with general-purpose macro exerciser#16

Merged
moCello merged 4 commits intomainfrom
mocello/test-contract-rewrite
Apr 10, 2026
Merged

Replace test-bridge with general-purpose macro exerciser#16
moCello merged 4 commits intomainfrom
mocello/test-contract-rewrite

Conversation

@moCello
Copy link
Copy Markdown
Member

@moCello moCello commented Apr 8, 2026

Summary

Replace the EVM-flavored test-bridge contract with a domain-neutral test contract designed to exercise every #[contract] macro code path. The old contract mirrored the StandardBridge from dusk-evm, coupling the test suite to EVM terminology that obscured what each test actually verified. The new contract uses generic types (Item, ItemId, Ownable, Versioned) where every method exists because it tests a specific macro feature, not because it mirrors a domain operation.

Test contract rewrite:

  • Rename tests/test-bridge/tests/test-contract/
  • Replace types crate (660 → 200 lines): Item/ItemId/Ownable instead of EVMAddress/Deposit/WithdrawalId/PendingWithdrawal/OwnableUpgradeable
  • New contract exercises: scalar/reference/Option/nested-generic returns, single/multi/struct/reference params, event emission (unit + struct), streaming feeds, trait exposure with default impls, multiple trait impls, associated functions from traits (Versioned), custom data-driver encode/decode
  • Update contract-macro unit test fixtures to use my_crate:: paths
  • Test count preserved: 17 contract + 32 schema + 1 ignored
  • Update docs/design.md examples to use the new contract

Edition 2024 migration:

  • Set edition = "2024" and rust-version = "1.85" across all crates
  • Switch toolchain from nightly-2024-07-30 to stable
  • Bump dusk-core and dusk-vm to 1.6 (git deps from dusk-core-1.6.0 tag) for stable-compatible piecrust-uplink
  • Use #[unsafe(no_mangle)] in macro-generated code
  • Remove #![feature(let_chains)], -Z build-std, and edition2024-era version pins
  • Set HardFork::Aegis in test session for BLS V2 signature verification
  • Fix edition 2024 pattern matching and new clippy lints
  • Remove unused test helpers from test_session

moCello added 3 commits April 8, 2026 16:04
Replace the EVM-flavored test-bridge contract with a domain-neutral
test contract designed to exercise every #[contract] macro code path.

- Rename tests/test-bridge to tests/test-contract
- Replace types crate: Item/ItemId/Ownable instead of EVMAddress/
  Deposit/WithdrawalId/PendingWithdrawal/OwnableUpgradeable
- New contract: counter, label, items collection, Ownable + Versioned
  traits, custom data-driver, streaming feeds
- Update contract-macro unit test fixtures to use my_crate:: paths
- Test count preserved (17 contract + 32 schema + 1 ignored)
Replace all EVM-specific references (StandardBridge, Deposit,
EVMAddress, etc.) with the generic test contract types (TestContract,
Item, ItemId, CounterUpdated, etc.). Add trait exposure and associated
function examples. Add reference parameter edge case.
- Set edition = "2024" and rust-version = "1.85" across all crates
- Switch toolchain from nightly-2024-07-30 to stable
@moCello moCello force-pushed the mocello/test-contract-rewrite branch from 1c2ddf3 to ed73d2c Compare April 8, 2026 14:05
@moCello moCello changed the title Replace test contract with a general purpose one Replace test-bridge with general-purpose macro exerciser Apr 8, 2026
@moCello moCello requested a review from HDauven April 8, 2026 14:32
Copy link
Copy Markdown
Member

@HDauven HDauven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just two remarks to check

Use git dependency references for dusk-core and dusk-vm in the
contract template, matching the workspace root. Update the
new_command test to assert stable toolchain instead of nightly.
@moCello moCello merged commit a7e5012 into main Apr 10, 2026
2 checks passed
@moCello moCello deleted the mocello/test-contract-rewrite branch April 10, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants